package cn.explink.distributor.framework;

import java.util.List;

public class CommonTarget implements Target {

	// 是否被淘汰
	private boolean isKnockOut = false;

	// 分单对象（比如小件员、配送团队）具有的分单能力（能配送的区域，配送距离，所属配送团队，饱和度等）
	private List<CommonCondition> distributeAbilityList;

	// 初始分数为100
	private int score = 100;

	public CommonTarget() {
	}

	public CommonTarget(List<CommonCondition> distributeAbilityList) {
		this.distributeAbilityList = distributeAbilityList;
	}

	@Override
	public void setDistributeAbilityList(List<CommonCondition> distributeAbilityList) {
		this.distributeAbilityList = distributeAbilityList;

	}

	@Override
	public List<CommonCondition> getDistributeAbilityList() {
		return this.distributeAbilityList;
	}

	@Override
	public void decreaseScore(int score) {
		this.score -= score;
	}

	@Override
	public int getScore() {
		return this.score;
	}

	@Override
	public boolean isKnockOut() {
		return this.isKnockOut;
	}

	@Override
	public void setKnockOut() {
		this.isKnockOut = true;
	}
	
	@Override
	public void setKnockOutFalse() {
		this.isKnockOut = false;
	}

	@Override
	public final int compareTo(Target target) {
		if (this.getScore() > target.getScore()) {
			return -1;
		} else if (this.getScore() < target.getScore()) {
			return 1;
		} else {
			return 0;
		}
	}

}
